$(document).ready(function(){$("#btnGravar").click(function(){sendform()})});
function sendform()
{
    nomediretor = $("#txtNomeDiretor").val();
    patentediretor =  $("#txtPatenteDiretor").val();
    nomevice = $("#txtNomeVice").val();
    patentevice = $("#txtPatenteVice").val();
    //pasta = $("#txtPasta").val();
    email = $("#txtEmail").val();
    remetente = $("#txtRemetente").val();
    smtpserver = $("#txtSMTPServer").val();
    type = $("#txtSMTPType").val();
    port = $("#txtSMTPPort").val();                
    user = $("#txtSMTPUser").val();
    pwd = $("#txtSMTPPwd").val();

    $(".waiting").hide();
    $(".waiting").show();
    $("#btnGravar").attr("disabled", "disabled");

    $.post("GravarConfiguracao.php", {cNomeDir: nomediretor, cEmail: email, cRemetente: remetente,
                                      cSMTP: smtpserver, cType: type, cPort: port, cUser: user, cPwd: pwd, 
                                      cPatDiretor: patentediretor, cNomeVice: nomevice, cPatenteVice: patentevice}, 
        function(msg_txt)
        {
            if(msg_txt == false)
                alert(msg_txt);
            else
                alert(msg_txt);

            $(".waiting").slideToggle();
            $("#btnGravar").removeAttr("disabled");  
        });
}
